package net.bingosoft.common.struts.tags;

import net.bingosoft.common.config.Config;

import org.apache.struts.taglib.html.FileTag;

/**
 * 2007-11-29 下午07:21:44
 * Author:yangdongyu(yangdy@bingosoft.net)
 * ReadMe:支持对上传文件进行过滤的file 标签
 * ChangeLog:
 */
public class FilterableFileTag extends FileTag {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 不支持上传的文件格式,可通过配置文件配置
	 */
	private static final String REFUSED_FILE_TYPES = Config.getString("REFUSED_FILE_TYPES", "exe, bat, com");
	private boolean required = false;
	private String dataType = "Filter";
	private String parseType = "File";
	private String message = "非法的文件格式";
	/**
	 * 不支持上传的文件类型,内容为文件的扩展名,采用' ,'隔开
	 */
	private String refusedFiles = REFUSED_FILE_TYPES;
	
	public String getDataType() {
		return dataType;
	}
	public void setDataType(String dataType) {
		this.dataType = dataType;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public String getParseType() {
		return parseType;
	}
	public void setParseType(String parseType) {
		this.parseType = parseType;
	}
	public String getRefusedFiles() {
		return refusedFiles;
	}
	public void setRefusedFiles(String rejectFiles) {
		this.refusedFiles = rejectFiles;
	}
	public boolean isRequired() {
		return required;
	}
	public void setRequired(boolean required) {
		this.required = required;
	}
	@Override
	protected void prepareOtherAttributes(StringBuffer handlers) {
    	prepareAttribute(handlers, "DataType", dataType); 
    	prepareAttribute(handlers, "Message", message); 
    	prepareAttribute(handlers, "Required", required); 
    	prepareAttribute(handlers, "ParseType", parseType);
    	prepareAttribute(handlers, "RefusedFiles", refusedFiles);
	}
	

}
